#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSystemTrayIcon>
#include <QMenu>
#include <QAction>

#include "a_passive/passivehandler.h"
#include "a_active/screenlook.h"
#include "ui/dialogtemplate.h"
#include "dialogchangepass.h"
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
signals:
    void closeSignal();
public slots:
    //显示密码
    void showPasswd(bool show);
    void finishedSockeHandler();
    //显示连接成功信息
    void showInfoMessage(bool state);
    //显示ID
    void showDeviceId(QString id);
    //复制密码ID
    void copyPasswd();
    //显示改变密码对话框
    void showChangePassDialog();
    //设置密码
    void setTempPassword(const QString &password);
    //关于我
    void aboutMe();
private slots:
    void on_ed_remoteId_textChanged(const QString &arg1);
    void on_bt_connectRemoteDevice_clicked();
    //小图标事件
    void actionTriggered(QAction *action);
    void iconActivated(QSystemTrayIcon::ActivationReason ireason);

private:
    Ui::MainWindow *ui;
    PassiveHandler *m_passive_netWorkHandler ;
    DeviceInfo *qtyInfo ;
    DialogChangePass *m_changeDialog;
    DialogRemoteConnectError dlg_err ;

    bool m_isConnectedToNetty ;
    QMenu *m_trayMenu;
    QSystemTrayIcon *m_trayIcon;
    DialogTemplate *dlg_about_me;

    //ID空格处理
    QString last_String ;
    QString getRandomString();
    void loadSettings();
    void startPassiveConnect(DeviceInfo *qtyInfo);

};

#endif // MAINWINDOW_H
